Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Eip86 CREATE #4046

Closed
wants to merge 30 commits into from
Closed

Eip86 CREATE #4046

wants to merge 30 commits into from

Conversation

yann300
Copy link
Contributor

@yann300 yann300 commented Apr 19, 2017

  • Set the address of any contract created through a creation transaction to equal sha3(NULL_SENDER + sha3(init code)) % 2**160, where + represents concatenation, replacing the earlier address formula of sha3(rlp.encode([sender, nonce]))
  • Create a new opcode at 0xfb, CREATE_P2SH, which sets the creation address to sha3(sender + sha3(init code)) % 2**160. If a contract at that address already exists, fails and returns 0 as if the init code had run out of gas.

chfast and others added 3 commits April 14, 2017 18:07
On Travis CI limit cache to 1 GB and cleanup after the build. Print better CMake logs and stats.
@@ -391,6 +400,8 @@ bool Executive::go(OnOpFunc const& _onOp)
auto vm = _onOp ? VMFactory::create(VMKind::Interpreter) : VMFactory::create();
if (m_isCreation)
{
if (m_s.addressHasCode(m_newAddress))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this happens only after Metropolis (although I doubt I can trigger this right now).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember there is a test case about this...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That stuff will basically never return true before Metropolis. but yeah that worth testing only after metro

@winsvega
Copy link
Contributor

I'will start working on the tests tomorrow.


h160 MetropolisFakeExtVM::create(u256 _endowment, u256& io_gas, bytesConstRef _init, OnOpFunc const&, Instruction _creationType)
{
(void)_creationType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this line?

Copy link
Contributor Author

@yann300 yann300 Apr 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not it will not build (not used parameter are treated as error)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter is used below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well wait... you're right :) don't need this line

@pirapira
Copy link
Member

Looks OK except the Travis failure.

libevm/VM.cpp Outdated

CASE(CREATE_PSH)
{
m_bounce = &VM::caseCreate;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be available only after Metropolis and generate BadInstruction before. See for example how REVERT handles this

remove blockHash tests from stateTests
@gumb0
Copy link
Member

gumb0 commented Apr 19, 2017

Also the changes are needed in libevmcore/Instruction.cpp - add new instuction to c_instructionInfo - it's used to calculate instruction price; and to c_instructions - it's used by vmtrace

See my changes for REVERT https://github.com/ethereum/cpp-ethereum/pull/3635/files#diff-eebc659bb21aa390ba67700a3586fb13

@@ -80,5 +80,12 @@ class FakeExtVM: public eth::ExtVMFace
u256 execGas;
};

class MetropolisFakeExtVM: public FakeExtVM
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class looks not used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep we will try to remove the entire fakeExtVM with @winsvega

@@ -298,7 +298,7 @@ class ExtVMFace
virtual void suicide(Address) { sub.suicides.insert(myAddress); }

/// Create a new (contract) account.
virtual h160 create(u256, u256&, bytesConstRef, OnOpFunc const&) { return h160(); }
virtual h160 create(u256, u256&, bytesConstRef, OnOpFunc const&, Instruction) { return h160(); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would better make OnOpFunc parameter the last one, because it's kind of different than all the others - all others are configuring the creation and this one is a callback

@chfast chfast added this to the Metropolis milestone Apr 21, 2017
@yann300
Copy link
Contributor Author

yann300 commented Apr 21, 2017

will move to #4051

@yann300 yann300 closed this Apr 21, 2017
@axic axic deleted the eip86_create branch January 12, 2018 09:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants